package com.umerclass.ui.anmo.one;

import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.LinearLayout;

import androidx.fragment.app.Fragment;
import androidx.viewpager.widget.ViewPager;

import com.google.android.material.tabs.TabLayout;
import com.umerclass.AppDroid;
import com.umerclass.R;
import com.umerclass.bean.anmo.TeamGroupBean;
import com.umerclass.frame.model.InfoResult;
import com.umerclass.frame.okhttp.OkEntityListRequest;
import com.umerclass.frame.ui.activity.BaseActivity;
import com.umerclass.ui.anmo.adapter.MyFragmentPagerAdapter;
import com.umerclass.utils.Constants;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.OnClick;

public class MyYeJiActivity extends BaseActivity {

    @BindView(R.id.linear_back)
    LinearLayout linearBack;
    @BindView(R.id.tab)
    TabLayout tab;
    @BindView(R.id.viewpager)
    ViewPager viewpager;
    private List<String> titles = new ArrayList<>();
    private MyFragmentPagerAdapter myFragmentPagerAdapter;

    @Override
    public boolean isImmersionBarEnabled() {
        return false;
    }

    @Override
    public boolean isSupportSwipeBack() {
        return false;
    }

    @Override
    public int getLayoutResId() {
        return R.layout.activity_anmo_one_team;
    }

    @Override
    public void init() {
        Window window = getWindow();
        window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
        window.setStatusBarColor(getResources().getColor(R.color.white));
        titles.add("代理佣金");
        titles.add("仪器分润");
        tab.addTab(tab.newTab().setText("代理佣金"));
        tab.addTab(tab.newTab().setText("仪器分润"));
        YeJiFragment yeJiFragment = new YeJiFragment();
        YeJiFragmentTwo yeJiFragment2 = new YeJiFragmentTwo();
        ArrayList<Fragment> fragments = new ArrayList<>();
        fragments.add(yeJiFragment);
        fragments.add(yeJiFragment2);
        myFragmentPagerAdapter = new MyFragmentPagerAdapter(getSupportFragmentManager());
        myFragmentPagerAdapter.setFragments(fragments);
        myFragmentPagerAdapter.setTitles(titles);
        viewpager.setAdapter(myFragmentPagerAdapter);
        tab.setupWithViewPager(viewpager);
        viewpager.setCurrentItem(0);
        viewpager.setOffscreenPageLimit(2);
    }

    @Override
    public void loadData() {

    }

    @OnClick({R.id.linear_back})
    public void OnClick(View view) {
        switch (view.getId()) {
            case R.id.linear_back:
                finish();
                break;
            default:
                break;
        }
    }

    @Override
    protected void onSuccess(int what, InfoResult t) {
    }

    @Override
    protected void onFail(int what, InfoResult t) {

    }

}
